package practice1_100;

public class Offer28 {
    public boolean isSymmetric(TreeNode root) {
        if(root==null)return true;
        return check(root.left,root.right);
    }

    public boolean check(TreeNode left,TreeNode right){
        if(left==null&&right==null) return true;
        if(left!=null&&right==null) return false;
        if(left==null&&right!=null) return false;
        return left.val==right.val&&check(left.right,right.left)&&check(left.left,right.right);

    }

    public static void main(String[] args) {

    }
}
